<?php
$data = $_REQUEST['inData'];
// $data ='PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48cmVxdWVzdD48Ym9keT48b3JkZXJJbmZvPjxwYXJ0bmVyb3JkZXJJZD4xNDQxNzQyPC9wYXJ0bmVyb3JkZXJJZD48b3JkZXJRdWFudGl0eT4xPC9vcmRlclF1YW50aXR5PjxldGlja2V0VGlja2V0UXVhbnRpdHk+MDwvZXRpY2tldFRpY2tldFF1YW50aXR5PjxldGlja2V0VXNlUXVhbnRpdHk+MTwvZXRpY2tldFVzZVF1YW50aXR5PjxldGlja2V0UmV0dXJuZWRRdWFudGl0eT4wPC9ldGlja2V0UmV0dXJuZWRRdWFudGl0eT48ZXRpY2tldENvbnN1bWVJbmZvPjwvZXRpY2tldENvbnN1bWVJbmZvPjwvb3JkZXJJbmZvPjwvYm9keT48L3JlcXVlc3Q+';
if (!class_exists("go_sql")){
	include("/var/www/html/new/conf/le.je");
	$le=new go_sql();
	$le->connect();
}
include('/var/www/html/new/d/module/api/function.class.php');

$arr = base64_decode($data);

$PFT_infunction = new AllFunction();
$PFT_infunction->logfile('11|'.$arr,'checkNote');

$arr = simplexml_load_string($arr);
$pftorder = (string)$arr->body->orderInfo->partnerorderId; //订单号
$UseQuantity = (string)$arr->body->orderInfo->eticketUseQuantity; //消费数量

$inSide = new SoapClient(null,array(
			"location" => "http://localhost/open/openService/pft_insideMX.php",
			"uri" => "www.16u.com?ac_16u=16ucom|pw_16u=c33367701511b4f6020ec61ded352059|auth_16u=true")
);
$pft_order = $inSide->Order_Globle_Search(
		0,0,0,0,"",
		"","","","","",
		"","",$pftorder,"",0,
		"","","",1,0,
		0,1,"","","",
		"","","","","",
		"","","1","",""
);
if(strlen($pft_order)>50){
	$pft_order_xml=simplexml_load_string($pft_order);
	$UUsalerid  = (string)$pft_order_xml->Rec->UUsalerid;
	$UUlid  = (string)$pft_order_xml->Rec->UUlid;
	$UUtordernum = explode("_",(string)$pft_order_xml->Rec->UUtordernum);
	$UUcode  = (string)$pft_order_xml->Rec->UUcode;
	$chkIns = 499;
	if((string)$pft_order_xml->Rec->UUstatus==2) $chkIns = 498;
	
	$terminal = $PFT_infunction->Unified_Check_IN($UUsalerid,$UUcode,date('Y-m-d H:i:s'),$chkIns);
	if($terminal  == 100){
		$PFT_infunction->logfile('11|'.$pftorder.'|'.$UUtordernum[1].'|'.$UUtordernum[0].'|'.$terminal,'check_s');
		$selorder = "update all_api_order  set oStatus=1 where pftOrder='$pftorder' limit 1";
		$GLOBALS['le']->query($selorder);
		$repMsg = 'success';
	}else{
		$PFT_infunction->logfile('11|'.$pftorder.'|'.$UUtordernum[1].'|'.$UUtordernum[0].'|'.$terminal,'check_f');
		$repMsg = "fail";			
	}
}
else $repMsg='fail';

if($repMsg){
	$response=<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<response>
	<body> 
		<message>{$repMsg}</message>
	</body>
</response>
XML;
	print_r($response);
}
?>